package com.example.demo.web.rest.task;

import com.example.demo.mapper.UserMapper;
import io.swagger.annotations.ApiModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author shiwq
 * @date 2021/5/25 10:46
 * @describe
 */
@ApiModel("用户相关定时任务")
@Component
@Configuration
@EnableScheduling
public class ScheduledUser {
    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private UserMapper userMapper;


    @Scheduled(cron = "${scheduled.user.lock}")
    public void userLockScheduled() {
        userMapper.lockUser();
    }
}
